import { request } from '@/utils/request.js'

/**
 * 托盘 API JS
 */

export default {

  /**
   * 获取托盘分页列表
   * @returns
   */
  getList (params = {}) {
    return request({
      url: 'warehouse/tray/index',
      method: 'get',
      params
    })
  },

  /**
   * 添加托盘
   * @returns
   */
  save (data = {}) {
    return request({
      url: 'warehouse/tray/save',
      method: 'post',
      data
    })
  },

  /**
   * 更新托盘数据
   * @returns
   */
  update (id, data = {}) {
    return request({
      url: 'warehouse/tray/update/' + id,
      method: 'put',
      data
    })
  },

  /**
   * 读取托盘
   * @returns
   */
  read (id) {
    return request({
      url: 'warehouse/tray/read/' + id,
      method: 'get',
      data
    })
  },

  /**
   * 将托盘删除，有软删除则移动到回收站
   * @returns
   */
  deletes (data) {
    return request({
      url: 'warehouse/tray/delete',
      method: 'delete',
      data
    })
  },

  /**
   * 从回收站获取托盘数据列表
   * @returns
   */
  getRecycleList (params = {}) {
    return request({
      url: 'warehouse/tray/recycle',
      method: 'get',
      params
    })
  },

  /**
   * 恢复托盘数据
   * @returns
   */
  recoverys (data) {
    return request({
      url: 'warehouse/tray/recovery',
      method: 'put',
      data
    })
  },

  /**
   * 真实删除托盘
   * @returns
   */
  realDeletes (data) {
    return request({
      url: 'warehouse/tray/realDelete',
      method: 'delete',
      data
    })
  },

  /**
   * 更改托盘数据
   * @returns
   */
  changeStatus (data = {}) {
    return request({
      url: 'warehouse/tray/changeStatus',
      method: 'put',
      data
    })
  },

  createTray(data = {},id){
    return request({
      url: 'warehouse/delivery/tray/'+id,
      method: 'post',
      data
    })
  },
  takeself(data = {}){
    return request({
      url: 'warehouse/tray/takeself',
      method: 'post',
      data
    })
  },
  back(data = {}){
    return request({
      url: 'warehouse/tray/back',
      method: 'post',
      data
    })
  },
  over(data = {}){
    return request({
      url: 'warehouse/tray/over',
      method: 'post',
      data
    })
  },
  splitBack(data = {}){
    return request({
      url: 'warehouse/tray/splitBack',
      method: 'post',
      data
    })
  },

}